package com.eningqu.aipen.logic.network;

import com.eningqu.aipen.utils.GlobalConfig;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Package:com.eningqu.aipen.logic.network
 * Author:starr
 * Time:2023/10/4  12:00
 * Description: 百度第三方业务网络请求封装
 */
public class ChatRetrofitUtils {
    private static volatile Retrofit retrofit=null;

    public static Retrofit getInstance(){
        if(retrofit==null){
            synchronized (ChatRetrofitUtils.class){
                if(retrofit==null){
                    retrofit = new Retrofit.Builder()
                            .baseUrl(GlobalConfig.getBaiduUrl())
                            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
                            .addConverterFactory(GsonConverterFactory.create())
                            .client(ShareOkHttpClient.getClient())
                            .build();
                }
            }
        }
        return retrofit;
    }
}
